#include <iostream>
#include <queue>
using namespace std;

const int kMaxXY = 510;
const int kInf = 1e9;

int dis[kMaxXY][kMaxXY];
queue<pair<int, int>> que;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

void BFS() {
  while (!que.empty()) {
    int x = que.front().first, y = que.front().second;

    que.pop();
    for (int i = 0; i < 4; i++) {
      int nx = x + dir[i][0], ny = y + dir[i][1];

      if (dis[nx][ny] == kInf) {
        dis[nx][ny] = dis[x][y] + 1;
        que.push(make_pair(nx, ny));
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m, a, b;

  cin >> n >> m >> a >> b;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dis[i][j] = kInf;
    }
  }
  for (int i = 0; i < a; i++) {
    int x, y;

    cin >> x >> y;
    dis[x][y] = 0;
    que.push(make_pair(x, y));
  }

  BFS();
  for (int i = 0; i < b; i++) {
    int x, y;
    cin >> x >> y;
    cout << dis[x][y] << "\n";
  }
  return 0;
}